import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:gt_flutter_admin/app/routes.dart';
import 'package:gt_flutter_admin/res/strings.dart';
import 'package:gt_flutter_admin/widgets/image_picker/image_picker_controller.dart';

import '../utils/request_utils.dart';
import '../utils/toast_utils.dart';

class App {
  // 运行app
  static void run() async {
    RequestUtils.init();
    await GetStorage.init();

    runApp(ToastUtils.init(MyApp()));
  }
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp.router(
      title: APP_NAME,
      localizationsDelegates: [BrnLocalizationDelegate.delegate],
      getPages: routes,
      initialBinding: BindingsBuilder(() {
        Get.put(() => ImagePickerController(), permanent: true);
      }),
    );
  }
}
